package com.github.wxiaoqi.security.example.rest;

import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.example.biz.DemoBiz;
import com.github.wxiaoqi.security.example.entity.Demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.awt.*;
import java.util.List;

@Controller
@RequestMapping("demo")
public class ExampleController  extends BaseController<DemoBiz, Menu> {

    @Autowired
    private DemoBiz demoBiz;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public List<Demo> list(String title) {
        List<Demo> demoList= demoBiz.selectListAll();
        System.out.println(demoList.get(0).getDemoName());
        return  demoList;
    }

    @RequestMapping(value = "/getById/{id}", method = RequestMethod.GET)
    @ResponseBody
    public Demo getDemo(@PathVariable int Id) {
        return demoBiz.selectNameById(Id);
    }


}

